package main

import (
	"fmt"
	"github.com/BurntSushi/toml"
	"io/ioutil"
	"os"

)


type BaseData struct {
	confData ConfData `toml:"confData"`
}

type ConfData struct {
	Mysql MysqlConf `toml:"mysql"`
	CsvFile   string `toml:"csvFile"`
}
type MysqlConf struct {
	Ip string `toml:"ip"`
	User string `toml:"user"`
	Password string `toml:"password"`

}
func readConf(fname string) (p *BaseData, err error) {
	var (
		fp *os.File
		fcontent []byte
	)
	p = new(BaseData)
	if fp, err = os.Open(fname); err != nil {
		fmt.Println("open error ", err)
		return
	}

	if fcontent, err = ioutil.ReadAll(fp); err != nil {
		fmt.Println("ReadAll error ", err)
		return
	}
	fmt.Println("fcontent", fcontent)
	if err = toml.Unmarshal(fcontent, p); err != nil {
		fmt.Println("toml.Unmarshal error ", err)
		return
	}
	return
}



func main()  {

}